<?php
$mangaTitle = $language->page->chapter->manga->title;
$chapterTitle = $language->page->chapter->title;
$pageTitle = 'Page ' . $language->page->humanSequence;
$breadcrumbs = array(
	$mangaTitle=>array(
		'manga/view',
		'id'=>$language->page->chapter->mangaId
	),
	$chapterTitle=>array(
		'chapter/view',
		'id'=>$language->page->chapterId
	),
	$pageTitle=>array(
		'page/view',
		'id'=>$language->page->id
	),
	$model->dialect . ' Translation',
);
$this->breadcrumbs = $breadcrumbs;

$this->menu = array(
	array('label'=>'List Translation', 'url'=>array('index')),
	array('label'=>'Manage Translation', 'url'=>array('admin')),
);
?>

<h1>
	Manage <?php echo $model->dialect; ?> Translation <?php echo $pageTitle; ?>
</h1>

<div class="right">
	<?php
	$action = array('translation/create');
	echo CHtml::beginForm($action, 'get');
	$properties = array(
		'name'=>'dialect',
		'value'=>$_GET['dialect'],
		'source'=>array(
			'English',
			'Japanese',
			'Chinese',
		),
		'htmlOptions'=>array('placeholder'=>'Language'),
		'options'=>array('showAnim'=>'fold'),
	);
	$this->widget(
		'zii.widgets.jui.CJuiAutoComplete', $properties
	);
	echo ' ';
	$htmlOptions = array('class'=>'page-nav');
	echo CHtml::dropDownList('languageId', $language->id, $navList, $htmlOptions);
	echo ' ';
	echo CHtml::submitButton('Go');
	echo CHtml::endForm();
	?>
</div>

<div class="clear"></div>

<div class="view">
	<center>
		<?php
		$src = $language->fileUrl;
		$alt = '';
		$htmlOptions = array('id'=>'mangascan');
		echo CHtml::image($src, $alt, $htmlOptions);
		?>
	</center>
</div>

<div class="right">
	<?php
	$action = array('translation/create');
	echo CHtml::beginForm($action, 'get');
	$properties = array(
		'name'=>'dialect',
		'value'=>$_GET['dialect'],
		'source'=>array(
			'English',
			'Japanese',
			'Chinese',
		),
		'htmlOptions'=>array('placeholder'=>'Language'),
		'options'=>array('showAnim'=>'fold'),
	);
	$this->widget(
		'zii.widgets.jui.CJuiAutoComplete', $properties
	);
	echo ' ';
	$htmlOptions = array('class'=>'page-nav');
	echo CHtml::dropDownList('languageId', $language->id, $navList, $htmlOptions);
	echo ' ';
	echo CHtml::submitButton('Go');
	echo CHtml::endForm();
	?>
</div>

<div class="clear"></div>

<?php
EjQueryNotes::register();
$url = Yii::app()->theme->baseUrl . '/css/jQueryNotes.1.css';
Yii::app()->clientScript->registerCssFile($url);
$params = array(
	'dialect'=>$_GET['dialect'],
	'languageId'=>$_GET['languageId'],
);
$operator = $this->createUrl('translation/ajax', $params);
$options = array(
	'operator'=>$operator,
	'allowLink'=>false,
	'allowAuthor'=>Yii::app()->user->isGuest,
	'allowDelete'=>Yii::app()->user->id == 1,
	'minWidth'=>20,
	'minHeight'=>20,
	'helper'=>'mangascan',
);
$option = json_encode($options);
$script = "$(\"#mangascan\").jQueryNotes($option);";
Yii::app()->clientScript->registerScript('init-jquery-notes', $script);

Yii::app()->clientScript->registerScript(
	'page-nav-submitter',
	'
    $(".page-nav").change(
        function() {
            $(this).parent().submit();
        }
    );
    '
);
?>
